import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home.vue';

const Layout = () => import('@/views/layouts/layout.vue');// 布局组件
const Index = () => import('@/views/index/index.vue');// 医单云主页
const Doctor = () => import('@/views/doctor/index.vue');// 专家
const Shop = () => import('@/views/shop/index.vue');// 商城
//个人中心
const User = () => import('@/views/user/index.vue');// 我的
const Member = () => import('@/views/user/member.vue');// 健康档案
const MemberUpdate = () => import('@/views/user/member_update.vue');// 档案更新
const Group = () => import('@/views/user/group.vue');// 分组管理
const GroupUpdate = () => import('@/views/user/group_update.vue');// 分组更新
const Error404 = () => import('@/views/page/404.vue');// 404
Vue.use(VueRouter)

const routes = [
    {
        path: '/', component: Layout, redirect: '/',
        children: [
            {path: '/', name: 'Index', component: Index, meta: {title: '医单云'}},
            {path: '/doctor', name: 'Doctor', component: Doctor, meta: {title: '专家问诊'}},
            {path: '/shop', name: 'Shop', component: Shop, meta: {title: '在线商城'}},
            {path: '/404', name: 'Error404', component: Error404, meta: {title: '404'}},
        ],
    },
    {
        path: '/user',
        component: Layout,
        children: [
            {path: '/user', name: 'User', component: User, meta: {title: '个人中心'}},
            {path: '/member', name: 'Member', component: Member, meta: {title: '个人中心-健康档案'}},
            {path: '/member/update', name: 'MemberUpdate', component: MemberUpdate, meta: {title: '个人中心-档案更新'}},
            {path: '/group', name: 'Group', component: Group, meta: {title: '个人中心-我的分组'}},
            {path: '/group/update', name: 'GroupUpdate', component: GroupUpdate, meta: {title: '个人中心-分组更新'}},
        ],
    },
]

const router = new VueRouter({
    mode: 'history',
    base: process.env.BASE_URL,
    routes
})

export default router
